package com.wenzhi.studentservice.beanuse;

import com.wenzhi.studentservice.configurarion.BeanConfiguration;
import com.wenzhi.studentservice.entity.UserEntity;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class BeanPractice {
    public static void main(String[] args) {
        // 加载spring IoC，基于注解
         try (AnnotationConfigApplicationContext applicationContext =
                      new AnnotationConfigApplicationContext("com.wenzhi.studentservice.entity")) {
             System.out.println(applicationContext.getBean(UserEntity.class));
             System.out.println(applicationContext.getBean("userEntity"));
         } catch (Exception e) {
             e.printStackTrace();
         }
    }
}
